<?php

class ConsultasComponent extends Component {

	function __construct() {
		$this->Cliente = ClassRegistry::init('Cliente');		
	}

	function buscarSigesilFunc($documento) {
		$Cliente = $this->Cliente->query("SELECT * FROM fnc_buscar_sigesil('" . $documento . "') as v (silo character varying,tipo text,documento character varying(16),razon_social character varying(255),condicion text,
			cosecha_cultivo character varying(255),cantidad bigint,toneladas text )");
            return $Cliente;

		//V4071273
        //J085070400

	/*
		$Cliente = $this->Cliente->query("select * from fnc_buscar_sigesil('" . $documento . "') AS v (centro text, ced_rif text, nombre text, tipo text, movimiento text, cultivo text, cantidad integer)");

		ANTERIOR: 
		SELECT * FROM fnc_buscar_sigesil('J085070400') as v (silo character varying,tipo text,documento character varying(16),razon_social character varying(255),condicion text,
		cosecha_cultivo character varying(255),cantidad bigint,toneladas text );
	*/

	}

	function buscarSimaFunc($documento) {
    	$Cliente = $this->Cliente->query("select * from fnc_buscar_sima('" . $documento . "') as (nombre character varying(70), apellido character varying(50), ced_rif character varying(13), unidad_productiva character varying(120), sectors character varying(80), sub_sectors character varying(70), rubro_unificado character varying(100), rubro character varying(100), ha double precision);");
            return $Cliente;
	}
}
